package com.example.shellshopping.YCB_settings;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.example.shellshopping.R;

public class YCBSettingsZhifuActivity extends AppCompatActivity {

    RelativeLayout rl_one,rl_two;
    ImageView iv_one,iv_two,back;
    int changeStyle = 0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ycb_settings_zhifu_activity);
        initView();
        setListener();
    }

    View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.ycb_settings_zhifu_zhifubao:
                    changeStyleOne();
                    break;
                case  R.id.ycb_settings_zhifu_weixin:
                    changeStyleTwo();
                    break;
                case R.id.ycb_settings_zhifu_back:
                    finish();
                    break;
            }
        }
    };

    private void changeStyleTwo() {
        if(changeStyle == 0){
            iv_two.setVisibility(View.VISIBLE);
            iv_one.setVisibility(View.INVISIBLE);
            changeStyle = 1;
        }
    }

    private void changeStyleOne() {
        if(changeStyle == 1){
            iv_one.setVisibility(View.VISIBLE);
            iv_two.setVisibility(View.INVISIBLE);
            changeStyle = 0;
        }
    }

    private void setListener() {
        rl_one.setOnClickListener(onClickListener);
        rl_two.setOnClickListener(onClickListener);
        back.setOnClickListener(onClickListener);
    }

    private void initView() {
        rl_one = findViewById(R.id.ycb_settings_zhifu_zhifubao);
        rl_two = findViewById(R.id.ycb_settings_zhifu_weixin);
        iv_one = findViewById(R.id.ycb_settings_zhifu_zhifubao_selected);
        iv_two = findViewById(R.id.ycb_settings_zhifu_weixin_selected);
        back = findViewById(R.id.ycb_settings_zhifu_back);
    }
}